-- -*- mode: Haskell;-*- 
-- Filename:    parallelOgram.cf 
-- Authors:     lgm                                                    
-- Creation:    Wed Jan 14 20:46:51 2009 
-- Copyright:   Not supplied 
-- Description: 
-- ------------------------------------------------------------------------

Mixed               . ProcessExpr       ::= CollectionExpr                            ;
Selected            . ProcessExpr       ::= SummationExpr                             ;
Engaged             . ProcessExpr       ::= ReceiveExpr                               ;
Carried             . ProcessExpr       ::= SendExpr                                  ;                             
Served              . ProcessExpr       ::= "*" SiteExpr                              ;
Varied              . ProcessExpr       ::= ProcessVar                                ;
Emptied             . ProcessExpr       ::= "0"                                       ;

CollectedExtension  . CollectionExpr    ::= "{" [ProcessExpr] "}"                     ;
CollectedIntension  . CollectionExpr    ::= "{" ProcessPtn "|" [ProcessDeclOrCond] "}";
Switched            . SummationExpr     ::= "switch" SummationBody                    ;
SwitchedExtension   . SummationBody     ::= "{" [ReceiveExpr] "}"                     ;
SwitchedIntension   . SummationBody     ::= "{" GuardedPtn "|" [GuardedDeclOrCond] "}";

Synched             . ReceiveExpr       ::= SiteExpr "?" AbstractionExpr              ;
CoSynched           . SendExpr          ::= SiteExpr "!" InformationExpr              ;

Abstracted          . AbstractionExpr   ::= ExchangeFormals ProcessExpr               ;
Manifested          . InformationExpr   ::= "(" [ExchangeExpr] ")"                    ;

ExchangeFormalSpec  . ExchangeFormals   ::= "(" [ExchangeExpr] ")"                    ;

MixtureDestructed   . ProcessPtn        ::= "{:" [ProcessPtn] ":}"                    ;
SelectionDestructed . ProcessPtn        ::= ":switch:" SelectionBodyPtn               ;
ReceiveDestructed   . ProcessPtn        ::= GuardedPtn                                ;
SendDestructed      . ProcessPtn        ::= SitePtn ":!" InformationPtn               ;
ServeDestructed     . ProcessPtn        ::= ":*" SelectionBodyPtn                     ;
ProcessPtnLiteral   . ProcessPtn        ::= "'" ProcessExpr                           ;
ProcessPtnPVar      . ProcessPtn        ::= ProcessVar                                ;
ProcessPtnWild      . ProcessPtn        ::= Wild                                      ;

SelectBodyDestruct  . SelectionBodyPtn  ::= "{" [GuardedPtn] "}"                      ;
GuardedDestruct     . GuardedPtn        ::= SitePtn ":?" AbstractionPtn               ;
InformationDestruct . InformationPtn    ::= "(" [ProcessPtn] ")"                      ;
AbstractionDestruct . AbstractionPtn    ::= FormalsPtn ProcessPtn                     ;

SiteQuotePtn        . SitePtn           ::= ":$" ProcessPtn "$:"                      ;
SiteVarPtn          . SitePtn           ::= SiteVar                                   ;
SiteWildPtn         . SitePtn           ::= Wild                                      ;

FormalsDestruct     . FormalsPtn        ::= "(" [PtnPtn] ")"                          ;
PtnLiteralDestruct  . PtnPtn            ::= "@" "(" ProcessPtn ")"                    ;
PtnVarDestruct      . PtnPtn            ::= "@" UIdent                                ;

Substituted         . ExchangeExpr      ::= ProcessPtn                                ;
Variable            . ExchangeExpr      ::= SiteVar                                   ;

ProcessRequired     . ProcessDeclOrCond ::= ProcessCondition                          ;
ProcessGenerated    . ProcessDeclOrCond ::= ProcessGenerator                          ;
ProcessGenExpr      . ProcessGenerator  ::= ProcessPtn "<-" ProcessExpr               ;
ProcessReqExpr      . ProcessCondition  ::= ProcessPtn "in" ProcessProperty           ;

GuardedRequired     . GuardedDeclOrCond ::= GuardedCondition                          ;
GuardedGenerated    . GuardedDeclOrCond ::= GuardedGenerator                          ;
GuardedGenExpr      . GuardedGenerator  ::= GuardedPtn "<-" ReceiveExpr               ;
GuardedReqExpr      . GuardedCondition  ::= GuardedPtn "in" GuardedShape              ;

ProcessDisjunction  . ProcessProperty   ::= ProcessProperty "||" ProcessProperty1     ;
ProcessConjunction  . ProcessProperty1  ::= ProcessProperty1 "&" ProcessProperty2     ;
ProcessNegation     . ProcessProperty2  ::= "~" ProcessProperty2                      ;
ProcessStructure    . ProcessProperty2  ::= ProcessShape                              ;
ProcessGround       . ProcessProperty2  ::= GroundProcessProperty                     ;

_                   . ProcessProperty   ::= ProcessProperty1                          ;
_                   . ProcessProperty1  ::= ProcessProperty2                          ;
_                   . ProcessProperty2  ::= "(" ProcessProperty ")"                   ;

MixtureProp         . ProcessShape      ::= "{?" [ProcessProperty] "?}"               ;
ReceiveProp         . ProcessShape      ::= GuardedShape                              ;
SendProp            . ProcessShape      ::= SiteProp "?!" InformationShape            ;
ServeProp           . ProcessShape      ::= "?*" SelectionBodyShape                   ;

DataShape           . InformationShape  ::= "(?" [ProcessProperty] "?)"               ;
SelectBodyProp      . SelectionBodyShape ::= "{" [GuardedShape] "}"                   ;
GuardedProp         . GuardedShape      ::= SiteProp "??" AbstractionProp             ;
AbstractedProp      . AbstractionProp   ::= FormalsProp ProcessProperty2              ;
SiteShape           . SiteProp          ::= "?$" ProcessProperty "$?"                 ;

ParamsProp          . FormalsProp       ::= "(" [FormalProp] ")"                      ;
ParamIdentProp      . FormalProp        ::= UIdent                                    ;
ParamShapeProp      . FormalProp        ::= SiteProp                                  ;

ProcessLogicGround  . GroundProcessProperty ::= LogicalGround                         ;

Verity              . LogicalGround       ::= "true"                                  ;
Absurdity           . LogicalGround       ::= "false"                                 ;
Nullity             . LogicalGround       ::= "Nil"                                   ;

SiteIdent           . SiteExpr          ::= LIdent                                    ;
SiteQuotation       . SiteExpr          ::= "$" ProcessExpr "$"                       ;

SiteVarIdent        . SiteVar           ::= LIdent                                    ;
--SiteWild            . SiteVar           ::= Wild                                      ;

ProcessIdent        . ProcessVar        ::= UIdent                                    ;
--ProcessWild         . ProcessVar        ::= Wild                                      ;

(: [])              . [ProcessExpr]     ::= ProcessExpr                               ;
(:)                 . [ProcessExpr]     ::= ProcessExpr "," [ProcessExpr]             ;

(: [])              . [ProcessPtn]      ::= ProcessPtn                                ;
(:)                 . [ProcessPtn]      ::= ProcessPtn "," [ProcessPtn]               ;

[]                  . [PtnPtn]          ::=                                           ;
(: [])              . [PtnPtn]          ::= PtnPtn                                    ;
(:)                 . [PtnPtn]          ::= PtnPtn "," [PtnPtn]                       ;

[]                  . [ExchangeExpr]    ::=                                           ;
(: [])              . [ExchangeExpr]    ::= ExchangeExpr                              ;
(:)                 . [ExchangeExpr]    ::= ExchangeExpr "," [ExchangeExpr]           ;

[]                  . [ProcessDeclOrCond] ::=                                         ;
(: [])              . [ProcessDeclOrCond] ::= ProcessDeclOrCond                       ;
(:)                 . [ProcessDeclOrCond] ::= ProcessDeclOrCond "," [ProcessDeclOrCond];

[]                  . [GuardedDeclOrCond] ::=                                         ;
(: [])              . [GuardedDeclOrCond] ::= GuardedDeclOrCond                       ;
(:)                 . [GuardedDeclOrCond] ::= GuardedDeclOrCond "," [GuardedDeclOrCond] ;

[]                  . [GuardedShape]    ::=                                           ;
(: [])              . [GuardedShape]    ::= GuardedShape                              ;
(:)                 . [GuardedShape]    ::= GuardedShape "," [GuardedShape]           ;

[]                  . [ProcessProperty] ::=                                           ;
(: [])              . [ProcessProperty] ::= ProcessProperty                           ;
(:)                 . [ProcessProperty] ::= ProcessProperty "," [ProcessProperty]     ;

[]                  . [ProcessShape]    ::=                                           ;
(: [])              . [ProcessShape]    ::= ProcessShape                              ;
(:)                 . [ProcessShape]    ::= ProcessShape "," [ProcessShape]           ;

[]                  . [FormalProp]      ::=                                           ;
(: [])              . [FormalProp]      ::= FormalProp                                ;
(:)                 . [FormalProp]      ::= FormalProp "," [FormalProp]               ;

(: [])              . [ReceiveExpr]     ::= ReceiveExpr                               ;
(:)                 . [ReceiveExpr]     ::= ReceiveExpr "," [ReceiveExpr]             ;

(: [])              . [GuardedPtn]      ::= GuardedPtn                                ;
(:)                 . [GuardedPtn]      ::= GuardedPtn "," [GuardedPtn]               ;

comment "//"      ;
comment "/*" "*/" ;

token UIdent (upper (letter | digit | '_')*) ;
token LIdent (lower (letter | digit | '_')*) ;
token Wild   '_' char* ;